/*!
 * TidyBlog 2.0
 * Pagebase - v1.0.0 (2013-10-05T15:32:56+0800)
 * https://code.google.com/p/tidyblog/ | Released under MIT license
 */
define(function(require, exports, module) { 'use strict';

require('./express-nav');

var $ = require('dom/1.0.x/'), ajax = require('ajax/1.1.x/');

// 轮询检查是否有未审核评论
var $commentManage = $("#comment-manage");
if ($commentManage.length) {
	var getUnreviewedCount = function() {
		ajax.send({
			url: '/Manage_Comment/UnreviewedCount',
			onsuccess: function(result) {
				result = parseInt(result);
				if (result) {
					$commentManage.find('em').text(result);
					$commentManage.css('display', 'inline');
				} else {
					$commentManage.css('display', '');
				}

				setTimeout(getUnreviewedCount, 60000);
			}
		});
	}
	getUnreviewedCount();
} else {
	$commentManage = null;
}

});